'use strict';
import React, {Component, PropTypes} from 'react';
import { connect } from 'react-redux';
import { Switch,Input,Form,Checkbox,Tabs,Row,Col} from 'antd';
import { setDialog }   from '../../../reducers/common/actions.js';
import { saveRow }   from '../../../reducers/role/actions.js';
const FormItem = Form.Item;
const CheckboxGroup = Checkbox.Group;
const TabPane = Tabs.TabPane;

class PermissionItemBox extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        let {item,subItem} = this.props;
        return (
            <div className="per_item">
                <div className="per_title">
                    <b>{subItem.title}</b>
                </div>
                <div className="per_sub_items">
                    {subItem.items.map((subSubItem,i)=>{
                        return (
                            <label className="per_sub_item" key={i}>
                                <Checkbox
                                    checked={this.props.getCheckboxValue(subSubItem.method,subSubItem.url)}
                                    onClick={this.props.onChangeCheckbox.bind(this,subSubItem.method,subSubItem.url)}
                                />&nbsp;
                                {subSubItem.title}
                            </label>
                        )
                    })}
                </div>
            </div>
        )
    }
}

export default PermissionItemBox;